#{extends 'organization.html' /}
#{set title:'Action Items' /}

<h1 class="viewTitle">Details of action item</h1>
<div class="viewContent">
	<div id="actionItemWrapper">
		#{if item != null}

				<div id="actionItemHead">
				
					<div id="actionItemStatus">
						<p id="timeRange">
							#{if item.startDate != null && item.endDate != null}
							
								To be done from ${item.formatStartDate()} till ${item.formatEndDate()}
							
							#{/if} #{else}
								
								Start and end date not specified
								
							#{/else}
						</p>
						<p id="status">
							Status: ${item.status}
						</p>
						<div class="clear"></div>
					</div>					
				</div>
				
				<div id="actionItemBody">
				
					<table id="actionItemDetails">
						<colgroup>
							<col width="170">
						</colgroup>						
						<tr>
							<td><p>According entity:</p></td>
							<td>
								#{if item.entity != null}
									<p>${item.entity.name}</p>
								#{/if} #{else}
									<p>Not assigned to an entity yet</p>
								#{/else}
							</td>
						</tr>
						<tr>
							<td><p>According plan:</p></td>
							<td><p> ${item.plan.title}</p></td>
						</tr>
						<tr>
							<td><p>Description:</p></td>
							<td><p>${item.description}</p></td>
						</tr>
						<tr>
							<td><p>Tags:</p></td>
							<td>
							#{if !item.tags.isEmpty()}
									<p>
										Assigned tags to this item: 
										#{list items:item.tags, as:'tag'}
											${tag.name}, 
										#{/list}
									</p>
								#{/if} #{else}
									<p>
										No tags assigned yet
									</p>
								#{/else}
							</td>
						</tr>
					</table>
				
				</div>
				
				<a href="@{Application.showEditActionItem(item.getId())}" class="standardLink">Edit Action Item</a>
				
		#{/if} #{else}
		
			<div class="error"><p class="error">The requested action item is not available</p></div>
			
		#{/else}
	
	</div>
</div>